home *** CD-ROM | disk | FTP | other *** search
-
- 8: TEXT AND WINDOWS
-
- Text Attributes
- PEN (set colour of text)
-
- PEN index
- The PEN instruction sets the colour of all the text which will be
- displayed in the current window. This colour can be chosen from one up
- to 64 different possibilities depending on the gfx mode you're using.
- Example:
- PEN 6
-
- =PEN$(n) (change the pen colour using ctrl chrars)
-
- a$=PEN$(n)
-
- PEN$ returns a special control sequence which changes the pen colour
- inside a string. The new pen colour will be automatically assigned
- whenever this string is subsequently printed on the screen. Example:
-
- C$=Pen$(2)+"White "+Pen$(6)+"Blue"
- Print C$
-
- The string returned by PEN$ is in the format:
- Chr$(27)+"P"+Chr$(48+n)
-
- PAPER (set colour of the text background)
-
- PAPER index
-
- "index" can be a number between 0-63.
-
- =PAPER$(n) (return a control sequence to
- set the paper colour)
-
- x$=PAPER$(index)
-
- PAPER$ returns a character string which automatically changes the
- background colour when it's printed on the screen. For example:
-
- Pen 1: C$=Paper$(2)+"White "+Paper$(6)+"Blue"
- Print C$
-
-
- INVERSE ON/OFF (enter inverse mode)
-
- INVERSE ON/OFF
-
- The INVERSE command swaps the text and the background colours.
-
- SHADE ON/OFF (shade all subsequent text)
-
- SHADE ON/OFF
-
- SHADE ON highlights your text by reducing the brightness of the
- characters with a mask pattern. The shade of your text can be returned
- to normal using SHADE OFF
-
- UNDER ON/OFF (set underline mode)
-
- UNDER ON/OFF
-
- UNDER ON underlines your text when it's printed on the screen. UNDER
- OFF turns off the mode.
-
- WRITING (change text writing mode)
-
- WRITING w1 [,w2]
-
- The WRITING command allows you to change the writing mode used for all
- subsequent text operations. This determines precisely how your new text
- will be combined with the existing screen data.
-
- w1=0 REPLACE (Default) Your new text will obliterate
- anything underneath it.
- w1=1 OR Merges the characters onto the
- screen with a logical OR.
- w1=2 XOR Chars are combined now with XOR.
-
- w1=3 IGNORE Printing operations are ignored!
-
- The secont number chooses which parts of the text will be printed on
- the screen. This option can be omitted if required.
-
- w2=0 Normal The text is output to the screen along with
- the background.
- w2=1 Paper Only the background of the text is drawn on
- the screen.
- w2=2 Pen Ignores the paper colour and writes the
- text on a background of colour zero.
-
- Do *NOT* confuse this with GR WRITING!
-
- Cursor functions
- AMOS includes a range of facilities which let you move cursor to any
- part on the screen.
-
- LOCATE (position the cursor)
-
- LOCATE x,y
- LOCATE x, Locate moves the text cursor to the coordinates x,y.
- LOCATE ,y This sets the starting point for all future printing
- operations. All screen positions are specified using
- a special set of text coordinates. These are meadured in units of a
- single character relative to the top left corner of the text window.
- For instance the coordinates 15,10 refer to a point 10 chars down and
- 15 to the right.
-
- If you attempt to print something outside window limits an error will
- be generated.
-
- Note that the current screen is always treated as window 0. So you
- don't have to actually open a window before using one of these
- functions.
-
- CMOVE (relative cursor movement)
-
- CMOVE w,h
-
- Moves the cursor a fixed distance away from its present position. If
- your cursor was at 10,10, then typing:
-
- CMOVE 5,-5
-
- would move the cursor to 15,5. Like LOCATE you can omit either one of
- the coordinates as required.
-
- =AT (return a sequence of ctrl chars
- to position the cursor)
-
- x$=AT(x,y)
-
- The AT function allows you to change the position of text directly from
- inside a character string. It works by returning a string in the
- format:
- Chr$(27)+"X"+Chr$(27)+"Y"+Chr$(48+Y)
-
- Whenever this string is printed, the text cursor will be moved to the
- coordinates x,y. For example:
-
- A$="This"+At(10,10)+"Is"+At(1,2)+"The Power Of"+At(20,20)+"AMOS!"
- Print A$
-
- These AT commands are perfect for hi-score tables as they allow you to
- position our text once and for all during your programs initialisation
- phase. You can now update the score at the correct point on the screen
- using a single print statement. Here's an example:
-
- HI_SCORE$=At(20,10)+"Hi Score "
- SCORE=10000
- Print HI_SCORE$;SCORE
-
- Conversion functions
- AMOS Basic provides you with four useful functions which readliy enable
- you to convert between text and graphics coordinates.
-
- =XTEXT (convert an x coordinate gfx->text format)
- =YTEXT (convert an y coordinate gfx->text format)
-
- t=XTEXT(x)
- t=YTEXT(y)
-
- These functions take normal x/y coordinates and convert them to text
- coordinates relative to the current window. If the screen coordinate
- lies outside this window then a negative value will be returned. See
- EXAMPLE 8.1.
-
- =XGRAPHIC (convert an x coordinate text->gfx format)
- =YGRAPHIC (convert an y coordinate text->gfx format)
-
- g=XGRAPHIC(x)
- g=XGRAPHIC(y)
-
- These functions are effectively the inverse of XTEXT and YTEXT in that
- they take a text X (or) Y coordinate ranging from 0 to the width/height
- of the current window and convert them to absolute screen coordinates.
- See EXAMPLE 8.2
-
- Cursor commands
- The text cursor serves as a visible starting point of all future text
- operations. It's usually displayed as a flashing horizontal bar,
- although this may be changed using the SET CURS and CURS OFF commands.
-
- By moving the cursor on the screen, you can position your text
- practically anywhere you like. Remember, all coordinate measurements
- are taken using TEXT coordinates relative to the current window.
-
- HOME (cursor home)
-
- HOME
-
- Moves the text cursor to the top left hand corner of the current window
- (coordinates 0,0)
-
- CDOWN (cursor down) 93
- CDOWN
-
- Pushes the text cursor down by a single line.
-
-
-
- =CDOWN$ (return a Chr$(31) character)
- x$=CDOWN$
-
- CDOWN$ is a function which returns a special control character which
- automatically moves the cursor when it is printed. So Print CDOWN$ is
- identical to CDOWN. CDOWN$ allows you to combine several cursor
- movements in a single string. For example:
-
- C$="\"+Cdown$
- For A=0 to 20
- Print C$;
- Next A
-
-
- CUP (cursor up)
- CUP
-
- Moves the text cursor up a line in the same way that CDOWN moves down.
-
- =CUP$ (return a Chr$(30) character)
- x$=CUP$
-
- CUP$ returns a control string which moves the cursor up by a single
- character.
-
- CLEFT (cursor left)
- CLEFT
-
- Displaces the text cursor one character to the left.
-
- =CLEFT$ (Control string for CLEFT Chr$(29))
- x$=CLEFT$
-
- Moves the text cursor one character left. Works like =CUP$.
-
- CRIGHT (cursor right)
- CRIGHT
-
- Moves cursor one place to the right.
-
- =CRIGHT$ (Generate a Chr$(28) control string for CRIGHT)
-
- x$=CRIGHT$
-
- Is the opposite of CLEFT$.
-
- XCURS (return the X coordinate of the text cursor)
- YCURS (return the Y coordinate of the text cursor)
-
- x=XCURS
- y=YCURS
-
- XCURS is a variable containing the current X coordinate of the text
- cursos (in text format). YCURS holds the Y coordinate of the cursor.
-
- SET CURS (set text cursor shape)
-
- SET CURS L1,L2,L3,L4,L5,L6,L7,L8
-
- This instructoin allows you to change the shape of the cursor to
- anything you like. The shape is specified by a list of bit-patterns
- held in the parameters L1-L8, Each parameter determines the appearance
- of the horizontal line of the cursor, numbered from top to bottom.
-
- Every bit represnts a single point in the current cursor line. If
- it's set to 1 then the point will be drawn using colour number 3 -
- otherwise it will be displayed in the current PAPER colours. Example:
-
- L1=%11111111
- L2=%11111110
- L3=%11111100
- L4=%11111000
- L5=%11110000
- L6=%11100000
- L7=%11000000
- L8=%10000000
- Set Curs L1,L2,L3,L4,L5,L6,L7,L8
-
- CURS ON/OFF (enable/disable text cursor)
-
- CURS ON makes text cursor visible
- CURS OFF hides the cursor in current window
-
- MEMORIZE X/Y (save the X or Y
- coordinates of the text cursor)
- MEMORIZE X
- MEMORIZE Y
- The Memorize commands store the current cursor position.
-
- REMEMBER X/Y (restore the X or Y
- coordinate of the text cursor)
- REMEMBER X
- REMEMBER Y
- REMEMBER positions the cursor at the coordinates saved
- by a previous call to MEMORIZE. If MEMORIZE has not been
- used then the coordinates will be set to zero. See EXAMPLE 8.3
-
- CLINE (clear part or all of the current cursor line)
-
- CLINE [n]
-
- Clears the line on which the cursor is positioned. If n is present then
- "n" characters are cleared starting at the current cursor position.
-
- CURS PEN (choose a new colour for the text cursor)
-
- CURS PEN n
-
- Changes the colour of the text cursor to index number n.
-
- Text Input/Output
-
- CENTRE (print a line of text centred on the screen)
-
- CENTRE a$
-
- Takes a string of characters in a$ and prints it in the centre of the
- screen. This text is always output on the current cursor line.
-
- Locate 0,1
- Centre "This is a centered TITLE"
-
- =TAB$ (print tabulation)
-
- x$=TAB$
-
- TAB$ returns a control character known as a TAB (Ascii 9). When this
- character is printed the text cursor will be immediately moved several
- places to the right. The size of this movement can be set using the SET
- TAB kommand. As a default, the tab spacing is set to four (4).
-
- SET TAB (change the tabulation)
-
- SET TAB n
-
- This specifies the distance the text cursor will move when TAB
- character is printed.
-
- REPEAT$ (repeat string)
-
- x$=REPEAT$(a$,n)
-
- The REPEAT$ function allows you to print out the same string of
- characters several times using a single PRINT statement.
-
- It works by adding a sequenve of control characters into variable X$.
- When this string is printed, AMOS simply repeats a$ to the screen n
- times. Possible values for n range between 1 and 207. See EXAMPLE 8.4.
-
- The format of the control string is:
-
- Chr$(27)+"RO"+A$+Chr$(27)+"R"+Chr$(48+n)
-
- Advanced Text Commands
-
- ZONE$ (set up a zone around a piece of text)
-
- x$=ZONE$(a$,n)
-
- The ZONE$ function surrounds a section of text with a screen zone.
- After you have defined one of these zones you can check for coillisions
- between the zone and the mouse using the ZONE function. This allows you
- to create powerful on-screen menus and dialogue boxes without having to
- resort to any complicated programming tricks.
-
- a$ is a string containing the text for one the "Buttons" in your
- dialogue box. This button will be activated automatically when you
- print x$ to the screen.
-
- n specifies the number of screen zone to be defined. The max. number
- of these zones depends on the value you specified with RESERVE ZONE.
-
- See the EXAMPLE 8.5 program in the MANUAL folder. The format of the
- control string is:
- Chr$(27)+"ZO"+A$+Chr$(27)+"R"+Chr$(48+n)
-
- BORDER$ (add a border to some text)
-
- x$=BORDER$(a$,n)
-
- This returns a string of control characters which instructs AMOS to
- draw a border aound the required text. It's commonly used in
- conjunction with the ZONE$ command to produve the fancy buttons found
- in dialogue boxes and alert windows.
-
- n is the border number ranging from 1 to 16 and a$ holds the text to
- be enclosed by the border. The text in a$ will start at the current
- cursor position so don't be surprised when you get strange results
- printing at 0,0. To create a screen zone by a border try this:
-
- Print Border$(Zone$(" CLICK HERE ",1),2)
-
- This would enclose the text with zone number 1 and border 2. The
- control sequence is:
- Chr$(27)+"EO"+A$+Chr$(27)+"R"+Chr$(48+n)
-
- HSCROLL (horizontal text scrolling)
-
- HSCROLL n
-
- This scrolls all the text in the currently open window horizontally by
- a single character position. n can take the following values:
-
- 1 = Move current line to the left
- 2 = Scrolls entire screen to the left
- 3 = Move current line to the right
- 4 = Move screen to the right
-
- VSCROLL (vertival scroll)
-
- VSCROLL n
-
- Scrolls the text in the currently open window vertically.
-
- 1 = Any text at the cursor line and below is scrolled down
- 2 = Text at cursor line or below is moved up
- 3 = Only text from the top of the screen to the cursor line
- is scrolled up
- 4 = Text from top of the screen to the current cursor position
- is scrolled down
- Blank lines are inserted
- to pad out the gap left by the scrollingoperation.
-
- Windows
- The AMOS windowing commands allow you to restrict your text and
- graphics operations just a part of the current screen.
-
- AMOS windows can be used with the zone commands to produce effective
- dialogue boxes such as file selectors and high score tables. A typical
- warning box, for instance, can be easily generated with just a couple
- lines of AMOS Basic.
-
- WINDOPEN (create a window)
-
- WINDOPEN n, x, y, w, h [,border [,set]]
-
- The WINDOPEN instruction opens a window and displays it on the screen.
- This window will now be used for all subsequent text operations.
-
- n is the number of the window to be defined. AMOS allows you to
- create as many windows as you like, limited only by the amount of
- available memory. As a default, window number zero is assigned to the
- current screen. So don't attempt to re-open this window using WINDOPEN
- or change it with WIND SIZE or WIND MOVE.
-
- x,y are the graphics coordinates of the top left hand corner of your
- new window. Since AMOS windows are drawn using the Amiga's blitter
- chip, the window area must always lie on a 16-pixel boundary. In order
- to achieve this, the x coordinates are automatically rounded to the
- nearest multiple of 16. Additionally, if you've included a border for
- your window, the X coordinate will be incremented by a further eight.
- This will ensure that the working area of your window always starts at
- the correct screen boundary. There are no restrictions whatsoever on
- the y coordinates.
-
- w,h specify the size in characters of the new window. These
- dimensios must always be divisible by 2.
-
- "border" selects a border style for your window. There are 16
- possible styles, with values ranging between 1 and 16.
-
- Window borders can also include up to two optional title lines. One
- title is displayed along the top of the window and another may be added
- at the bottom.
-
- AMOS windows may contain either text or graphics, just like the
- intuition system. Each window can be assigned it's own individual
- character set with the powerful WINDOW FONT command. There's also a
- powerful WIND SAVE instuction which saves the screen area inside your
- windows. Whenever you move one of these windows the contents underneath
- will be automatically redrawn. For example:
-
- For W=1 To 3
- Windopen W,(W-1)*96,50,10,101
- Paper W+3 : Pen W+6 : Clw
- Print "Window ";W
- Next W
-
- You can flick between these windows using the WINDOW command. Try
- typing the following statements from the Direct mode:
-
- Window 1 : Print "AMOS"
- Window 3 : Print "in action!"
- Window 2 : Print "Basic"
-
- The active window can always be distinguished by a flashing cursor -
- through this can be turned off using the CURS OFF command if required.
-
- WINDOW FONT (change window font)
-
- WINDOW FONT n
-
- Changes the font used by the current window to set n. n is the number
- of a graphics font which has been previously installed with the GET
- FONT command. This font *must* have dimensions of exactly 8x8.
- Proportional fonts are not allowed.
-
- Since the window vborders make use of some of these characters, you
- may get rather odd results when you're using standard WBench fonts.
-
- WIND SAVE (save the contents of the current window)
-
- WIND SAVE
-
- The WIND SAVE command allows you to move your windows anywhere on the
- screen without corrputing your existing display.
-
- Once you've activated this feature, any windows you subsequently open
- will automatically save the entire contents of the windows underneath.
- This area will be redrawn whenever you close a window or move it to a
- new position.
-
- It's important to note that this option saves the contents of the
- current window, rather than the one you are defining with WIND OPEN.
-
- At the start of your program the current window will be the default
- screen and will take up a massive 32k of memory. If you wished to save
- the background underneath a dialogue box the most of this memory would
- be completely wasted.
-
- The solution is to create a dummy window of the required size, and to
- position it over the zone you wish to save. You can now execute a WIND
- SAVE command and continue with your program as normal.
-
- When you subsequently call up your dialogue box the area underneath
- will be saved as part of your dummy window. So it will be automatically
- restored after your box has been removed.
-
- BORDER (change the window border of the)
- current screen)
-
- BORDER n,paper,pen
-
- The BORDER command sets the border of the current window to style
- number n. This border is drawn using a group of characters installed in
- the default font. It is therefore possible to create your own border
- styles using the font definer accessory.
-
- The paper and pen options allow you to freely choose the colours of
- your border. Acceptable border numbers range from 1 to 16.
-
- Any of the parameters may be omitted from this instuction so the
- following commands are legal:
-
- BORDER 2,,
- BORDER 2,,3
-
- TITLE TOP (define the upper title for
- the current window)
-
- TITLE TOP t$
-
- This instruction sets the top line of the current window to the title
- string in t$. Only bordered windows may be titled in this way.
-
- Windopen 5,1,1,20,10
- Title Top "Window Number 5"
- Wait Key
-
-
-
- TITLE BOTTOM (define the lower title for
- the current window)
-
- TITLE BOTTOM b$
-
- This command assigns the string b$ to the bottom title of the current
- window.
-
- WINDOW (change current window)
-
- WINDOW n
-
- WINDOW activates the window n as the current window. If the automatic
- saving system has been initiated, this window be immediately redrawn
- along with any of its contents. See EXAMPLE 8.6 in the Manual folder.
-
- =WINDON (Return the value current window)
-
- w=WINDOW
-
- WINDON returns the identification number of the currently active
- window.
-
- WIND CLOSE (close the current window)
-
- WIND CLOSE
-
- Deletes the current window. Use the WIND SAVE command if you want the
- area that was hidden be redrawn by.
-
- WIND MOVE (move a window)
-
- WINDMOVE x,y
-
- Windmove moves the current window to graphics coordinates x,y. As with
- the original window definitions the x coordinate will be rounded to the
- nearest 16-pixel boundary.
-
- WIND SIZE (change the size of the current window)
-
- WIND SIZE sx,sy
-
- This command changes the size of an AMOS window. The new sizes, sx and
- sy, are specified in units of a single character. Sx must be divisible
- by two. See EXAMPLE 8.7.
-
- If you've previously called the WIND SAVE command, the original
- contents of your window will be redrawn by this instruction. If the new
- window is smaller than the original one, any parts of the image which
- lie outside will be lost. Alternatively, if you've expanded your
- window, the area around your saved region will be filled with the
- current paper colour. Also note that after a WIND SIZE command the text
- cursor is always reset to coordinates 0,0.
-
- CLW (clear the current window)
-
- CLW
-
- Erases the contents of the current window and fills it with the current
- PAPER colour.
-
- Slider bars
- AMOS incorporates three insturctions which allow you to display a
- standard slider bar on the screen. These sliders cannot be manipulated
- directly with the mouse. In order to create a working slider bar,
- you'll need to write a small Basic routine to perform this operate in
- your main program. Due to the sheer power of the AMOS system, this is
- extremely easy to accomplish, and the results can be extremely
- impressive, as can be seen from EXAMPLE 8.8.
-
- HSLIDER (draw a horizontal slider)
-
- HSLIDER x1,y1 OT x2,y2,total,pos,size
-
- Draws a horizontal slider bar from x1,y1 to x2,y2. "total" is the
- number of individual units which the slider will be divided into. Each
- unit represents a single item in the object you are controlling with
- the slider. TSo in the editor window, "total" would be set to the
- number of lines in the current program. The size of each unit is
- calculated from the following formula:
-
- (X2-X1)/Total
-
- "pos" is the position of the slider box from the start of the slider,
- measured in the units you specified using "total". "size" is the length
- of the slider box in the previous units. See EXAMPLE 8.9.
-
- VSLIDER (draw a vertical slider)
-
- VSLIDER x1,y1 TO x2,y2,total,pos,size
-
- VSLIDER is almost identical to the previous HSLIDER insturction. It
- displays a simple slider from x1,y1 to x2,y2. See EXAMPLE 8.10.
-
- SET SLIDER (sets the fill patterns
- used in a slider)
-
- SET SLIDER b1,b2,b3,pb,s1,s2,s3,ps
-
- Although this command looks incredibly complicated, it's actually
- rather simple. SET SLIDER enters the colours and patterns to be used in
- the slider bars created with the H/VSLIDER commands.
-
- "b1,b2,b3" set the ink, paper and outline colours for the background
- of the box. "pb" chooses the fill pattern to be used for these regions.
-
- "s1,s2,s3" input the colours of the slider box, and "sp" selects the
- pattern it is to be filled with.
-
- "bp" and "sp" can be any fill patterns you wish. As usual, negative
- value refer to a sprite image from the current sprite bank. This allows
- you to create amazing colorful slider boxes.
-
- Fonts
- There are two different types of fonts available in AMOS - text fonts
- and graphic fonts. The text fonts are those used by the PRINT and
- WINDOW commands. Text fonts are known as character sets and each AMOS
- Basic window can have its own individual set. The graphic fonts are
- much more flexible and offer a wider range of styles:
-
- Graphic text
- Your Amiga computer is capable of displaying an impressive variety of
- different text styles. The original WorkBench disc was supplied with
- eight attractive fonts in a range of sizes, and many more of these
- fonts are freely available from the public domain. If you've upgraded
- to WorkBench 1.3, you'll also be able to design your own fonts using
- the FED program on the Extras disc.
-
- AMOS provides you with total support for these fonts. Text can be
- printed in any of the available typefaces at any point on the screen.
-
- AMOS fonts can be used to add spice to even the most Basic games.
- These are invaluable for producing the loading screens and hi-score
- tables in your games. So it's a good idea to make full use of them in
- your progs.
-
- TEXT (print graphical text)
-
- TEXT x,y,t$
-
- TEXT prints a line of text in t$ at graphical coordinates x,y. All
- coordinates are measured relative to the characters baseline. This can
- be determined using a special TEXT BASE function.
-
- Normally the baseline is positioned at the bottom of the character,
- but some lowercase letters, such as "g", have a "tail" which extends
- slightly below this point.
-
- As a default the type styles is set to eight-point Topaz. This may be
- changed at any time using the SET FONT instruction. Try the following
- program and notice how text can be placed at any pixel position on the
- screen.
-
- Do
- Ink Rnd(15)+1,Rnd(15): Text Rnd(320)+1,Rnd(198)+1,"AMOS Basic"
- Loop
-
- Al so notice how the colour of your text is set with INK rather than
- the expected PEN and PAPER commands. This emphasizes the fact that the
- TEXT command is basically a graphical instruction. So the control
- sequences created by functions like CUP$ will be printed on the screen
- instead of being correctly interpreted.
-
- There is no automatic line feed when the text reaches the end of the
- current window. If you attempt to print something too large, the text
- will be neatly clipped at the existing screen boundary. This can be
- seen by the example below:
-
- Print String$("A",100):Text 0,100,String$("A",100)
-
- GET FONTS (create a list of all available fonts)
-
- GET FONTS
-
- The GET FONTS command creates an internal list of the all fonts
- available from the current start-up disc. This list is essential to the
- running of the SET FONT command, so you should always call GET FONTS at
- least once before attempting to change the present font setting. The
- contents of this list can be examined using the FONT$ function.
-
- WARNING! In order for GET FONTS to work, your current AMOS work disc
- must always contain a copy of the standard LIBS folder along with its
- contents. It's important to remember this fact when you are
- distributing run-only or compiled programs because unless your discs
- contain the required files, AMOS Basic will almost certainly crash!
-
- GET DISC FONTS (create a list of the disc fonts)
-
- GET DISC FONTS
-
- This command is identical to the previous GET FONTS instruction except
- that it only searches for fonts on the disc. These fonts are contained
- in the FONTS folder on your current boot-disc. If you want to use your
- own fonts with AMOS basic, you'll need to copy these onto your normal
- start-up disc. See the manual supplied with your Amiga for details of
- this procedure.
-
- GET ROM FONTS (create a list of the rom fonts)
-
- GET ROM FONTS produces a list of the fonts which are built into Amiga's
- rom chips. At the present time there are just two of these fonts:
- Eight-point Topaz and nine-point Topaz.
-
- =FONT$ (return details about the available fonts)
-
- a$=FONT$(n)
-
- Returns a string of 38 chars which describes font number n. This
- function allows you to examine the font list created by a previous call
- to one of the GET FONT commands.
-
- a$ contains a list of characters which hold the name and type of your
- font. If a font does not exist, a$ will be loaded a null value "",
- otherwise a string will be returned in the following format:
-
- Character Description
- 1-29 Font name
- 30-33 Font height
- 34-37 Identifier (set to either Disc or Rom)
-
- See EXAMPLE 8.11!
-
- SET FONT (choose a font for use by
- the TEXT instruction)
-
- SET FONT n
-
- SET FONT changes the character set used by the TEXT command to font
- number n. If the font is stored on the disc it will be automatically
- loaded into your Amiga's memory. At the same time any previously sets
- which are not in use will be removed. See EXAMPLE 8.12.
-
- SET TEXT (set text style)
-
- SET TEXT style
-
- Allows you to change the style of a font. There are three styles to
- choose from. "style" is a bit pattern in the following format:
-
- Bit Effect
- 0 Underline By setting the appropriate bits in this
- 1 Bold pattern you can choose between a total
- 2 Italic of eight different text styles.
-
- =TEXT STYLE (return the current text style)
-
- s=TEXT STYLE
-
- This function returns the text style set from the SET TEXT command. The
- result in "s" is a bit-map in the same format as that used by SET TEXT.
-
- =TEXT LENGTH (return the length of a section of graphic text)
-
- w=TEXT LENGTH(t$)
-
- The TEXT LENGTH function returns the width in pixels of the character
- string a$ in the current font. The width of a character varies
- depending on the size of your fonts. In addition, proportional fonts
- such as Helvetica assign different widths for each individual
- character.
-
- =TEXT BASE (return the current text base)
-
- b=TEXT BASE
-
- This function returns the position of the baseline of your font. The
- baseline is the number of pixels between the top of a character and
- point it will be printed on the screen. It's basically similar to the
- hot spot of a sprite or bob.
-
- Installing new fonts
- If you wish to use your own fonts within AMOS Basic, you'll need to
- install them onto a copy of your AMOS program disc. The basic procedure
- is as follows:
-
- - Copy the required font files into the FONTS: directory of your boot-
- disc.
- - Further information can be found in the Extra's manual supplied with
- the Workbench 1.3 upgrade.
-
- Troubleshooting
- Problem: GET FONTS seems to ignore any of the fonts on the current
- disc.
- Solution: You've propably removed the original boot disc from your
- default drive. The Amiga's library routines expect to find
- the FONTS: directory on your start-up disc. This can be
- changed using the ASSIGN program in the UTILITIES folder.
-
- Problem: GET FONTS crahes the Amiga completely.
- Solution: This problem can easily occur when you're creating programs
- in run-only or compiled format. GET FONTS requires the
- discfont.library in the LIBS folder in order to work.
-
- Problem: The SET FONT command returns a "fonts not examined" error.
- Solution: Add a cal to GET FONTS to the start of your program.
-